PlotCIconHandle
PlotCIconHandle Display an icon image with System 7 icon resource types
#include <Icons.h> Finder Interface
OSErr PlotCIconHandle( theRect, align, transform , theResID);
Rect *theRect ; rectangle to draw in, in local coordinates
short alignment ; icon alignment type
short transform; icon transform type
short theCIconH; color icon handle.
PlotCIconHandle plots an icon image in the current GrafPort at local
coordinates specified by a rectangle.
theRect is the address of an 8-byte Rect structure, expressed in local
coordinates.
alignment alignment method used in case the icon does not exactly fit the
rectangle give. See the Notes section below.
transform desired appearance of the icon on the screen. See the Notes section
belwo
theCIconH handle to a standard QuickDraw color icon. Use GetCIcon to load a
color icon. Don't forget to dispose of it when you are done with
DisposCIcon (sometimes they can take up quite a bit of memory).
Returns: error code

Notes: PlotCIconHandle takes a parameter which specifies the aligment of the
icon in the destination rectangle. Most icons do not fully fill their rectangle,
and it is sometimes necessary to draw the icon relative to other data (like
menu text). For this reason, you can specify one of these standard alignment
values for the alignment parameter. You can add a vertical alignment to a
horizontal alignment to create a composite alignment value.
atNone
atVerticalCenter
atTop
atBottom
atHorizontalCenter
atLeft
atRight
The transform parameter specifies the mode or "transform" in which the
icon should be drawn. Transforms are analogous to certain Finder states for
the icons. For example the transform that you would use to show an icon of
a disk that has been ejected is ttOffline. The following transforms are
available.
ttNone
ttDisabled
ttOffline
ttOpen
ttSelected
ttSelectedDisabled
ttSelectedOffline
Note that the ttSelected transform can be added to any of the other
transform types.
Macintosh Technote #306 states that the actual appearance of the icon
drawn by each transform type may vary with future system software, so
you should always try to use the transform type that best fits the state it
represents in your application.
Additional transform types exist for displaying the icon of a file inside
your application that use the Finder's label colors to color the icon. To
determine the proper lable for a file's icon, you can check bits 1-3 of the
fdFlags in the file's Finder Info (obtained using GetFInfo or
PBGetFInfo). The bits contain a number from 0 to 7. Simply add the
corresponding ttLabel value to the transform that you pass to
PlotCIconHandle. The label values are
ttLabel0 ttLabel4
ttLabel1 ttLabel5
ttLabel2 ttLabel6
ttLabel3 ttLabel7
PlotCIconHandle chooses the appropriate icon based primarily on size;
once the proper icon size is determined (based on the destination
rectangle), the present member of that size with the deepest bit depth that
the current device can use is selected. A size category is considered present
if the black and white member (with mask) wis present, 'ICN#', 'ics#', or
'icm#'. PlotCIconHandle can be used for both picture accumulation and
printing.
This routine is not currently documented in MPW header files (hence, it is
not in any THINK C or THINK Pascal header file either). The information
given above comes from Macintosh Technical Note #306. This tech. note
also gives the inline glue for the call as follows:
pascal OSErr PlotCIconHandle (Rect * theRect, short alignment,
short transform, CIconHandle theResID)
= {0x303C, 0x061F, 0xABC9};